﻿<ResourceDictionary 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:TabbedWPFSample">

    <!-- Default spinner brush -->
    <SolidColorBrush x:Key="spinnerRectangleBrush" Color="Blue"/>
    
    <!-- Style for spinner rectangles -->
    <Style x:Key="spinnerRectangle" TargetType="Rectangle">
        <Setter Property="RadiusX" Value="5"/>
        <Setter Property="RadiusY" Value="5"/>
        <Setter Property="Width" Value="50"/>
        <Setter Property="Height" Value="20"/>
        <Setter Property="Fill" Value="{StaticResource spinnerRectangleBrush}"/>
        <Setter Property="Canvas.Left" Value="220"/>
        <Setter Property="Canvas.Top" Value="140"/>
        <Setter Property="Opacity" Value="0.1"/>
    </Style>
    
    <Canvas 
        Height="300" 
        Width="300" 
        Background="Transparent" 
        HorizontalAlignment="Center" 
        VerticalAlignment="Center" 
        x:Key="spinnerCanvas" 
        x:Shared="False">
        <!-- First quadrant -->
        <Rectangle Style="{StaticResource spinnerRectangle}" Opacity="1"/>
        <Rectangle Style="{StaticResource spinnerRectangle}">
            <Rectangle.RenderTransform>
                <RotateTransform Angle="22.5" CenterX="-70" CenterY="10"/>
            </Rectangle.RenderTransform>
        </Rectangle>
        <Rectangle Style="{StaticResource spinnerRectangle}">
            <Rectangle.RenderTransform>
                <RotateTransform Angle="45" CenterX="-70" CenterY="10"/>
            </Rectangle.RenderTransform>
        </Rectangle>
        <Rectangle Style="{StaticResource spinnerRectangle}">
            <Rectangle.RenderTransform>
                <RotateTransform Angle="67.5" CenterX="-70" CenterY="10"/>
            </Rectangle.RenderTransform>
        </Rectangle>

        <!-- Second quadrant -->
        <Rectangle Style="{StaticResource spinnerRectangle}">
            <Rectangle.RenderTransform>
                <RotateTransform Angle="90" CenterX="-70" CenterY="10"/>
            </Rectangle.RenderTransform>
        </Rectangle>
        <Rectangle Style="{StaticResource spinnerRectangle}">
            <Rectangle.RenderTransform>
                <RotateTransform Angle="112.5" CenterX="-70" CenterY="10"/>
            </Rectangle.RenderTransform>
        </Rectangle>
        <Rectangle Style="{StaticResource spinnerRectangle}">
            <Rectangle.RenderTransform>
                <RotateTransform Angle="135" CenterX="-70" CenterY="10"/>
            </Rectangle.RenderTransform>
        </Rectangle>
        <Rectangle Style="{StaticResource spinnerRectangle}">
            <Rectangle.RenderTransform>
                <RotateTransform Angle="157.5" CenterX="-70" CenterY="10"/>
            </Rectangle.RenderTransform>
        </Rectangle>

        <!-- Third quadrant -->
        <Rectangle Style="{StaticResource spinnerRectangle}" Opacity="0.2">
            <Rectangle.RenderTransform>
                <RotateTransform Angle="180" CenterX="-70" CenterY="10"/>
            </Rectangle.RenderTransform>
        </Rectangle>
        <Rectangle Style="{StaticResource spinnerRectangle}" Opacity="0.3">
            <Rectangle.RenderTransform>
                <RotateTransform Angle="202.5" CenterX="-70" CenterY="10"/>
            </Rectangle.RenderTransform>
        </Rectangle>
        <Rectangle Style="{StaticResource spinnerRectangle}" Opacity="0.4">
            <Rectangle.RenderTransform>
                <RotateTransform Angle="225" CenterX="-70" CenterY="10"/>
            </Rectangle.RenderTransform>
        </Rectangle>
        <Rectangle Style="{StaticResource spinnerRectangle}" Opacity="0.5">
            <Rectangle.RenderTransform>
                <RotateTransform Angle="247.5" CenterX="-70" CenterY="10"/>
            </Rectangle.RenderTransform>
        </Rectangle>

        <!-- Fourth quadrant -->
        <Rectangle Style="{StaticResource spinnerRectangle}" Opacity="0.6">
            <Rectangle.RenderTransform>
                <RotateTransform Angle="270" CenterX="-70" CenterY="10"/>
            </Rectangle.RenderTransform>
        </Rectangle>
        <Rectangle Style="{StaticResource spinnerRectangle}" Opacity="0.7">
            <Rectangle.RenderTransform>
                <RotateTransform Angle="292.5" CenterX="-70" CenterY="10"/>
            </Rectangle.RenderTransform>
        </Rectangle>
        <Rectangle Style="{StaticResource spinnerRectangle}" Opacity="0.8">
            <Rectangle.RenderTransform>
                <RotateTransform Angle="315" CenterX="-70" CenterY="10"/>
            </Rectangle.RenderTransform>
        </Rectangle>
        <Rectangle Style="{StaticResource spinnerRectangle}" Opacity="0.9">
            <Rectangle.RenderTransform>
                <RotateTransform Angle="337.5" CenterX="-70" CenterY="10"/>
            </Rectangle.RenderTransform>
        </Rectangle>
    </Canvas>

    <Canvas 
        x:Key="vistaDoughnut" 
        x:Shared="False" 
        Height="100" 
        Width="100" 
        HorizontalAlignment="Center" 
        VerticalAlignment="Center">
        <Ellipse 
            Canvas.Left="10" 
            Canvas.Top="10" 
            Width="80" 
            Height="80" 
            StrokeThickness="15" 
            StrokeEndLineCap="Triangle" 
            StrokeStartLineCap="Triangle">
            <Ellipse.Stroke>
                <LinearGradientBrush>
                    <LinearGradientBrush.GradientStops>
                        <GradientStop Color="#FF00D1FF" Offset="0"/>
                        <GradientStop Color="#FF000028" Offset="1"/>
                    </LinearGradientBrush.GradientStops>
                </LinearGradientBrush>
            </Ellipse.Stroke>
        </Ellipse>
    </Canvas>

    <!-- ContentSpinner -->
    <Style TargetType="{x:Type local:ContentSpinner}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:ContentSpinner}">
                    <Border 
                        Background="{TemplateBinding Background}" 
                        BorderBrush="{TemplateBinding BorderBrush}" 
                        BorderThickness="{TemplateBinding BorderThickness}">
                        <ContentPresenter 
                            Name="PART_Content" 
                            Margin="{TemplateBinding Padding}"/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="Canvas" Value="Rectangles">
                <Setter Property="Content" Value="{StaticResource spinnerCanvas}"/>
            </Trigger>
            <Trigger Property="Canvas" Value="Doughnut">
                <Setter Property="Content" Value="{StaticResource vistaDoughnut}"/>
            </Trigger>
        </Style.Triggers>
    </Style>

</ResourceDictionary>